<table class="full continuous">
		<thead>
		<tr>
			<th>ORDER DETAILS #1414 - <em style="color:#9FFFAC"><%= @order.order_status.name %></em></th>
		</tr>
		</thead>
</table>
<form action="<%= update_status_order_path(@order.id) %>" method="POST">
	<input type="hidden" name="_method" value="POST">
<table id="orderStatusUpdate" class="full continuous" style="display:none">
		<thead>
		<tr>
			<th colspan="2" style="background-color:#6F6F6F">Change Status</th>
		</tr>
		<tr>
			<td class="fieldValue" style="background-color:#EFEFEF;">
				New Status 
			</td>
			<td class="fieldValue" style="background-color:#EFEFEF;">
				<select name="order_status_history[order_status_id]" style="width:95%"><%= options_from_collection_for_select(OrderStatus.find(:all), "id", "name", @order.order_status_id) %></select>
			</td>
		</tr>
		<tr>
			<td class="fieldValue" style="background-color:#EFEFEF;">
				Comment
			</td>
			<td class="fieldValue" style="background-color:#EFEFEF;">
				<%= text_area "order_status_history", "comment", :style => 'height:50px' %>
			</td>
		</tr>
		<tr>
			<td class="fieldValue" style="background-color:#EFEFEF;border-bottom:4px solid #6F6F6F">
				&nbsp;
			</td>
			<td class="fieldValue" style="background-color:#EFEFEF;border-bottom:4px solid #6F6F6F">
				<input type="submit" value="Update Status" style="width:100px"> <input type="reset" value="Cancel"  onClick="Element.hide('orderStatusUpdate')"  style="width:100px">
				
			</td>
		</tr>
		</thead>
</table>
</form>
<table class="full continuous">
		<tr>
			<th class="sub" colspan="2">Addresses</th>
		</tr>
		<tr>
			<td class="fieldValue" width="50%">
				<strong>Billing Address:</strong><br />
				<%= @order.billing_address %><br>
				<%= @order.billing_city %><br>
				<%= @order.billing_postcode %><br>
				<%= @order.billing_country.name %><br>
				<strong>Contact</strong>
				{contact name}, {contact_number} </td>
			<td class="fieldValue">
				<strong>Shipping Address:</strong><br />
				<%= @order.shipping_address %><br />
				<%= @order.shipping_city %><Br />
				<%= @order.shipping_postcode %><Br />
				<%= @order.shipping_country.name %><br>
				<strong>Contact:</strong><br />
				<%= @order.shipping_contact %>, <%= @order.shipping_phone %>
			</td>
		</tr>
	
</table>
<table class="full continuous">
		<tr>
			<th class="sub" colspan="4">Shipping details</th>
		</tr>
		<tr>
			<td><strong>Ship Via:</strong><br>{own | UPS | Fedex}</td>
			<td><strong>Airway Bill #:</strong><br><%= @order.airway_bill_number %></td>
			<td><strong>Current Status:</strong><br><span style="color:orange;font-weight:bold">Not yet shipped</span></td>
		</tr>
</table>
<table class="full continuous">
		<tr>
			<th class="sub">Notes</th>
		</tr>
		<tr>
			<td><%= @order.notes %></td>
		</tr>
</table>
<table class="full continuous">
		<tr>
			<th class="sub" colspan="4">Order Lines</th>
		</tr>
		<% for order_line in @order.order_lines %>
		<tr class="dataRow">
			<td width="70%"><%= order_line.description %>  <% if order_line.id == 1 %><span style="color:red">! out of stock</span><% end %></td>
			<td><%= order_line.qty_ordered %></td>
			<td><%= order_line.price_as_ordered %></td>
			<td><%= @order.price_type.dollar_sign %><%= order_line.qty_ordered * order_line.price_as_ordered %></td>
		</tr>
		<% end %>
		<tr>
			<td colspan="3" class="total_header">Sub Total</td>
			<td><%= @order.price_type.dollar_sign %><%= @order.sub_total %></td>
		</tr>
		<tr>
			<td colspan="3" class="total_header">Shipping</td>
			<td><%= @order.price_type.dollar_sign %><%= @order.shipping_amount %></td>
		</tr>
		<tr>
			<td colspan="3" class="total_header">Tax</td>
			<td><%= @order.price_type.dollar_sign %><%= @order.tax_amount %></td>
		</tr>
		<tr>
			<td colspan="3" class="total_header" style="font-size: 130%">Total (<%= @order.price_type.symbol %>)</td>
			<td  style="font-size: 130%"><%= @order.price_type.dollar_sign %><%= @order.total_amount_payable %></td>
		</tr>
</table>
<table class="full continous">
		<tr>
			<th class="sub" colspan="3">Pricing Details  <em style="color:orange">Admin Only</em></th>
		</tr>
		<tr>
			<td><strong>Price Type:</strong><br><%= @order.price_type.title %></td>
			<td><strong>Discounts Applied:</strong><br>{ yes | no }</td>
			<td><strong>Discounts Table:</strong><br>{ table name }</td>
		</tr>
		<tr>
			<td colspan="3"><strong>Invoice Notes:</strong><br><%= @order.price_type.invoice_line_1 %><Br><%= @order.price_type.invoice_line_2 %></td>
		</tr>
		<tr>
			<th class="sub" colspan="3">Payment Details</th>
		</tr>
		<tr>
			<td><strong>Payment Via:</strong><br>{Credit Card | Transfer | Other}</td>
			<td><strong>Total Amount Paid to date:</strong><br>{$0.00} <a href="#">[+]</a></td>
			<td><strong>Payment Reference(s):</strong><br>{$0.00} <a href="#">[+]</a></td>
		</tr>
		<tr>
			<td colspan="3"><strong>Payment Terms:</strong><br><%= @order.payment_term.terms_text %></td>
		</tr>
</table>
<table class="full">
		<tr>
			<th class="sub" colspan="4">Order History</th>
		</tr>
		<tr>
			<td><strong>Date:</strong></td>
			<td><strong>User:</strong></td>
			<td><strong>To Status:</strong></td>
			<td><strong>Comment:</strong></td>
		</tr>
		<% for status in @order.order_status_histories %>
			<tr>
				<td><%= status.created_at %></td>
				<td>{user}</td>
				<td><%= status.order_status.name %></td>
				<td><%= status.comment %></td>
				
			</tr>	
		<% end %>
</table>
